import { useState} from 'react';
import {DatePicker,Button} from 'antd';
import locale from 'antd/es/date-picker/locale/zh_CN';
import 'dayjs/locale/zh-cn';
const Htmls = ({res,children,onGetHtmlsList})=>{
const [list , setList] =useState(12)
onGetHtmlsList(list)
     return (
     <div>{res}
<Button onClick={()=>{setList(list - 1)}}>{list}</Button>
     <p>{children}</p>
     </div>)
}
const  Time=({data})=> {
    const dateFormat = 'YYYY-MM-DD'
    const [time,setsTime] = useState([])
    const setTime = (...data)=>{
        console.log(data);
        // setsTime(data[1])
    }
 const  getList = (res)=>{
    console.log(res,1212);
    setsTime(res)
 }
    const [res,setData]= useState(10)
    return (
        <div>
            <Button onClick={()=>{setData(res+1)}}>{res}</Button>
    <DatePicker onChange={setTime} locale={locale}  format={dateFormat} />
    
    <Htmls res={res} onGetHtmlsList={getList}><div>{time}</div><div>{time}</div></Htmls>
    </div>
    )
}

export default Time